CC = g++
CFLAGS = -g -Wall
LIBS = 
BINS = server-connection server-dbwork client

.PHONY: all install uninstall clean
all: $(BINS)
install: 
	rm -rf ../bin
	mkdir ../bin
	cp $(BINS) ../bin
uninstall:
	rm -rf ../bin
clean:
	rm -rf *.o $(BINS)

%.o: %.cpp %.hpp constants.hpp
	$(CC) $(CFLAGS) -c $<
	
list.hpp:list.cpp
database.o: constants.hpp hash.hpp sparce_table.hpp list.hpp entry.hpp mystring.hpp
sparce_table.o: list.hpp entry.hpp
cartesian_tree.o: list.hpp entry.hpp

server-connection: server-connection.o 
	$(CC) $(CFLAGS) $(LIBS) -o $@ $^
	
server-dbwork: server-dbwork.o database.o sparce_table.o cartesian_tree.o hash.o mystring.o entry.o
	$(CC) $(CFLAGS) $(LIBS) -o $@ $^

client: client.o
	$(CC) $(CFLAGS) $(LIBS) -o $@ $^
